package com.twu.biblioteca.representation;

import java.util.*;

public class MainMenu extends Menu {
    private final static String QUIT_INFO = "To quit,please type 'q'!";

    private LinkedHashMap<String,String> menuList;

    public MainMenu() {
        menuList = new LinkedHashMap<String,String>();
        validOptions = new ArrayList<String>();
        menuList.put("1","view book");
        menuList.put("2","reserve book");
        menuList.put("3","view movie detail");
        menuList.put("4","login");
        menuList.put("5","view user detail");
        validOptions.add("1");
        validOptions.add("2");
        validOptions.add("3");
        validOptions.add("4");
        validOptions.add("5");
        validOptions.add("q");
    }

    public String  showMenu() {

        StringBuffer resultStr = new StringBuffer();
        Iterator iterator = menuList.entrySet().iterator();
        Map.Entry entry ;
        while(iterator.hasNext()) {

            entry = (Map.Entry) iterator.next();
            resultStr.append(entry.getKey() + ":" + entry.getValue()+"\n");
        }
        resultStr.append(QUIT_INFO);
        return resultStr.toString();
    }

}
